//
//  CardConsumCell.m
//  掌上宏力
//
//  Created by admin on 2017/5/23.
//  Copyright © 2017年 admin. All rights reserved.
//

#import "CardConsumCell.h"
#import "CardConsumModel.h"

static CGFloat Lab_H = 30;

@interface CardConsumCell ()

@property (nonatomic,weak) UILabel *shopNameL;
@property (nonatomic,weak) UILabel *typeL;
@property (nonatomic,weak) UILabel *moneyL;

@end
@implementation CardConsumCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        UILabel *shopNameL = [Factory createLabelWithFrame:CGRectMake(LeftDis, 5, kScreenW-20, Lab_H) fontSize:16];
        [self.contentView addSubview:shopNameL];
        self.shopNameL = shopNameL;
        
        UILabel *typeL = [Factory createLabelWithFrame:CGRectMake(LeftDis, shopNameL.bottom, 150, Lab_H) fontSize:15];
        [self.contentView addSubview:typeL];
        self.typeL = typeL;
        
        UILabel *moneyL = [Factory createLabelWithFrame:CGRectMake(kScreenW*0.5, shopNameL.bottom, kScreenW*0.3, Lab_H) fontSize:15];
        [self.contentView addSubview:moneyL];
        self.moneyL = moneyL;
        
    }
    return self;
}
-(void)setConsum:(CardConsumModel *)consum{
    self.shopNameL.text = consum.shopName;
    self.typeL.text = [NSString stringWithFormat:@"类型：%@",consum.type];
    self.moneyL.text = [NSString stringWithFormat:@"金额：%@￥",consum.money];
}

+(instancetype)cellWithTableView:(UITableView *)tableView{
    static NSString *cellId = @"consumCell";
    CardConsumCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
    if (cell == nil) {
        cell = [[CardConsumCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellId];
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    return cell;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
